package calbs.socket.analysis;

import calbs.socket.pojo.req.ReqData;
import calbs.socket.pojo.req.ReqFinishMsg;

/**
 * 终端完成接收数据，解析接口
 * Created by Q on 2017/8/3.
 */
public class DsFinishAnalysisImp implements AnalysisI<ReqFinishMsg>{
    @Override
    public ReqData<ReqFinishMsg> analysisMsg(ReqData<ReqFinishMsg> reqData){
        ReqFinishMsg  reqFinishMsg = reqData.getBody();
        String content = reqFinishMsg.getContent();
        Integer device = Integer.parseInt(content.substring(0,2*4),16);
        reqFinishMsg.setDevice(device.toString());
        content = content.substring(2*4);
        Integer dataSize = Integer.parseInt(content.substring(0,2*4),16);
        reqFinishMsg.setDataSize(dataSize.toString());
        return reqData;
    }
}
